home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: Question about exemplars
- Date: Sat, 16 Mar 1996 21:10:33 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4ifamt$5q0@news.halcyon.com>
- References: <31475C8B.41C6@corp.sgi.com>
- NNTP-Posting-Host: blv-pm3-ip13.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Vishwanath Raman <vish@corp.sgi.com> wrote:
-
- >I am building a message library using Exemplars. I write objects from a
- >given class hierarchy into a buffer ( contiguously ) and then send the
- >buffer accross to a server/peer. I bring the objects back to 'life' by
- >invoking a virtual MakeObject method defined through the hierarchy.
-
- >The problem is in trying to regenerate a message when the compilers used
- >in creating the client/peer and server/peer programs are DIFFERENT.
-
- >This I assume is because of the way VTable pointers are stored within
- >the class address space.
-
- >Any ideas to overcome this problem. Exemplars constitute a cool way of
- >regenerating hierarchy objects without parsing...
-
- >A standardisation for the way class objects are stored in memory seems
- >to be in order???
-
- >Thanks a mill for any feedback in advance, Vish
-
- >--
- >Vishwanath Raman
- >vish@corp.sgi.com
-
- No, the vtable thing is a non-issue. If you pass pointers across
- process boundaries, you need all sorts of special marshalling
- mechanisms; this doesn't sound like anything you need. Meanwhile,
- passing function pointers across process boundaries does not RPC make!
- Don't try it.
-
- Write the objects into a stream the same way you'd write them to disk.
- The objects don't exist in this stream, but are created normally at
- the other end of the pipe just like they would be if loaded from disk.
-
- The save and load, of course, goes member-by-member. The first things
- written are some kind of type identifier or other piece of data you
- can bang against your list of exemplar objects when looking for the
- right class to use.
-
- With member-by-member persistence, you avoid structure packing
- problems that a blanket Writefile( &myobj, sizeof(myobj)) would
- otherwise cause. You only need to agree that member X uses N bytes.
-
- You're using the exemplar idiom found in Copelein's "Advanced C++
- Styles and Idioms," are you?
-
- --Norm
-
-